<template>
	<view class="container">
		<!-- 内容主体 -->
		<view class="content">
			<view class="title">
				<text>登录</text>
			</view>
			<view class="input-item">
				<label>学号</label>
				<input type="text" v-model="studentid" placeholder="请输入" />
			</view>
			<view class="input-item">
				<label>密码</label>
				<input type="password" v-model="userPassword" placeholder="请输入密码" />
			</view>
			<view class="input-item">
				<checkbox v-model="rememberPassword">记住密码</checkbox>
			</view>
			<button @click="userLogin">登录</button>
		</view>

		<!-- 底部 -->
		<view class="footer">
			<text>© - 联系校事达官方客服：6666666</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				currentTab: 0,
				studentid: '',
				userPassword: '',
				rememberPassword: false,
				adminAccount: '',
				adminPassword: ''
			};
		},
		methods: {
			changeTab(index) {
				this.currentTab = index;
			},
			userLogin() {
				if (this.studentid.length < 3) {
					uni.showToast({
						title: '学号至少是得3个字符的啊',
						icon: 'none'
					});
					return;
				}
				if (!/(.+){3,12}$/.test(this.userPassword)) {
					uni.showToast({
						title: '密码是3到12位的哦',
						icon: 'none'
					});
					return;
				}
				// 这里可以添加普通用户登录的逻辑
				uni.showToast({
					title: '普通用户登录成功',
					icon: 'success'
				});
				uni.switchTab({
					url: '/pages/indexUser/indexUser'
				});
			}
		}
	};
</script>

<style scoped>
	.container {
		display: flex;
		flex-direction: column;
		min-height: 93vh;
	}

	.header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 20px;
		background-color: #f8f8f8;
	}

	.logo image {
		width: 70%;
	}

	.nav navigator {
		margin-left: 20px;
		color: #1E9FFF;
	}

	.content {
		flex: 1;
		padding: 20px;
		text-align: center;
	}

	.title {
		margin-bottom: 20px;
	}

	.input-container {
		border: 1px solid #ccc;
		padding: 20px;
		border-radius: 5px;
	}

	.tab {
		display: flex;
		justify-content: center;
		margin-bottom: 20px;
	}

	.tab view {
		padding: 10px 20px;
		cursor: pointer;
	}

	.tab view.active {
		color: #1E9FFF;
		border-bottom: 2px solid #1E9FFF;
	}

	.input-item {
		display: flex;
		align-items: center;
		margin-bottom: 20px;
	}

	.input-item label {
		width: 80px;
		text-align: right;
		margin-right: 10px;
	}

	.input-item input {
		flex: 1;
		border: 1px solid #ccc;
		padding: 10px;
		border-radius: 5px;
	}
	
	.input-item checkbox {
	    margin-left: 60px; /* 添加这一行 */
	}

	button {
		background-color: #1E9FFF;
		color: white;
		padding: 5px;
		border-radius: 5px;
		width: 100%;
		height: 50px;
	}

	.forgot-password {
		margin-top: 20px;
		margin-bottom: 20px;
	}

	.forgot-password navigator {
		color: #1E9FFF;
		display: inline-block;
		/* 如果需要元素之间有间距，可以使用 margin 属性 */
		margin-right: 10px;
	}

	.social-login {
		display: flex;
		justify-content: center;
	}

	.social-icon {
		font-size: 30px;
		color: #1E9FFF;
		margin: 0 10px;
	}

	.footer {
		text-align: center;
		padding: 20px;
		background-color: #f8f8f8;
	}
</style>